<template>
    <div class="showViewboxs" @click="chenge">
      <div class="showViewboxs_top">
        <span class="showViewboxs_text_size">
        设备  {{ listobjs.school_name }}
        </span>
        <div v-if="scheck">
                <t-checkbox v-model="select" @change="inspect"   style="font-size: 14px;padding: 0;background-color: transparent;"  ></t-checkbox>
              </div>
        <div v-else>
           
          <t-tag variant="light" :theme="listobjs.is_wifistatus == 1 || listobjs.is_camerastatus == 1? 'success': 'warning'" 
            >{{
                  listobjs.is_wifistatus == 1 || listobjs.is_camerastatus == 1
                    ? "正在使用"
                    : "未使用"
                }}</t-tag
          > 
        </div>
      </div>
      <div class="showViewboxs_cen">
        <div class="showViewboxs_cen_text">
          <span>区域：</span>
          <span
            >{{ listobjs.province }}{{ listobjs.city
            }}{{ listobjs.county }}(区/县)</span
          >
        </div>  
        <div class="showViewboxs_cen_text">
          <span>摄像头设备状态:</span> 
          <span>{{ director(listobjs.director_name) }}</span>

        </div>
        <div class="showViewboxs_cen_text">
          <span>WIFI设备状态:</span>
          <span>{{ director(listobjs.school_type) }} </span>
        </div>
      </div>
      <div>
          <slot name="booton"  >
  
          </slot>
      </div>
    </div>
  </template>
  
  
  <script>
  export default {
    props: {
      listobjs: {
        typeof: Object,
        default: function () {
          return {};
        },
      },
      // 是否全选
      selectArr:{
          typeof: Boolean,
        default: function () {
          return false;
        },
      }, 
      // 是否多选
      scheck: { 
        typeof: Boolean,
        default: function () {
          return false;
        },
      },
    },
    data() {
      return { 
        select: false, //是否选择多选
        options: [
        { label: "使用中", value: "1" },
        { label: "停止使用", value: "2" },
        { label: "已丢失", value: "3" },
        { label: "丢失补发", value: "4" },
      ],
      };
    },
    mounted() { 
      // 一开始就是全选
          this.select = this.selectArr;
          this.inspect();
    },
    methods: {
        // 状态
        director(v){
            let arrse=this.options.filter(item=>item.value==v)
            return arrse.length>0?arrse[0].label:'未知'
        },
      chenge(){
          if(this.scheck){
              this.select = !this.select
              this.inspect(); 
          } 
          else{
          this.$router.push({path:`/h5faciliy`,query:{id:this.listobjs.id}})
            
          }
      },
      inspect(){ 
          this.$emit('inspect',this.select,this.listobjs.id)
      }
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .showViewboxs {
    padding: 10px;
    background: #f6f6f6;
    margin: 10px 0;
    box-sizing: border-box;
    border-radius: 10px;
  }
  .showViewboxs_text_size {
    color: #030302;
    font-size: 16px;
    font-weight: 500;
    flex-wrap: nowrap;
    width: 80%;
    margin-right: 10px;
    white-space: nowrap; /* 防止文本换行 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 显示省略号 */
  }
  .showViewboxs_top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .showViewboxs_cen {
    font-size: 12px;
    color: #87898c;
    .showViewboxs_cen_text {
      line-height: 22px;
    }
  }
  </style>
  